import { PropertyKey } from "@/constants/constants";

export const TimeSeryChartConfigs = [
  PropertyKey.SelectPropertiesConfig_represents,
  PropertyKey.SelectPropertiesConfig_value,
  PropertyKey.TimeSeriesChart_annotateFailures,
  PropertyKey.TimeSeriesChart_fixedRange,
  PropertyKey.TimeSeriesChart_gridX,
  PropertyKey.TimeSeriesChart_gridY,
  PropertyKey.TimeSeriesChart_keepOpenAfterTermination,
  PropertyKey.TimeSeriesChart_maxValue,
  PropertyKey.TimeSeriesChart_minValue,
  PropertyKey.TimeSeriesChart_plotColor,
  PropertyKey.TimeSeriesChart_refreshRate,
  PropertyKey.SimulationConfig_UI,
  PropertyKey.TimeSeriesChart_Title,
  PropertyKey.TimeSeriesChart_YLabel,
  PropertyKey.TimeSeriesChart_LineraInterpolation,
  PropertyKey.TimeSeriesChart_fixedTimeLength,
  PropertyKey.TimeSeriesChart_fixedTimeLocation,
  PropertyKey.TimeSeriesChart_recordPlotDataAs,
  PropertyKey.TimeSeriesChart_resultFile
];

export const TimeLineChartConfigs = [
  PropertyKey.TimelineChart_Dynamic,
  PropertyKey.TimelineChart_IgnoredElements,
  PropertyKey.TimelineChart_ContextPlot,
  PropertyKey.TimeSeriesChart_Title,
  PropertyKey.TimeSeriesChart_YLabel,
  PropertyKey.SelectPropertiesConfig_represents,
  PropertyKey.TimelineChart_TimelineMode,
  PropertyKey.TimeSeriesChart_KeepOpenAfterTermination,
  PropertyKey.TimeSeriesChart_FixedTimeLocation,
  PropertyKey.TimelineChart_FixedTimeLength,
];

export enum ChartSubType {
  TimeSery = 'timesery',
  TimeLine = 'TimeLine',
}

export type UrlParam = {
  instanceId?: string,
  type: string,
  uiId?: string,
  modelId?: string,
  projectId?: string,
  simulationSessionId?: string,
  stepSize?: string,
  title?: string,
}

export type TimeSeryUpdate = {
  simulationSessionId: string,
  times: number,
  data?: any,
  consumers?: string[]
  isDirect?: boolean
  values?: string[]
  statusinfo?: {
    [key: string]: string
  }
}

export type TimeSeryMountedStorageData = {
  isMounted: false,
  simClockRatio: number,
  simStepSize: number,
}

export const SeriesColors = [
  '#61a0a8',
  '#32a332',
  '#d48265',
  '#91c7ae',
  '#749f83',
  '#ca8622',
  '#bda29a',
  '#6e7074',
];

export type ShowVariableDataStatus = {
  x: number
  status: string
}

export type ModelInfo = {
  id: string,
  name: string
}

export type TimeChartUiConfig = {
  [key: string]: {
    dataType: string,
    key: string,
    value?: any
  }
}

export type TimelineStatusUpdate = {
  x: number 
  y: string 
  id: string 
  nextId?: string // 格式::id,id => 特殊处理::分支节点
}

export class TimelineStatusSery {

  step = 'start';

  type = 'line';
  color = 'rgba(255, 173, 177, 1 )';
  label = {
    show: true,
    formatter: function () {
      const a = Array.from(arguments);
      console.log(a[0].name);
    }
  }
  data: any[] = [] 
  lastStatus = {}
}

export type TimelineActivityInitData = {
  behaviorId: string,
  behaviorName: string,
  ownerName: string,
  nodeDataList: {
    nodeId: string,
    nodeName: string,
    modelId: string
  }[]
}[]

export type TimelineUpdateData = {
  id: string,
  modelId: string,
  nextId: string,
  timestamp: number,
  modelName: string,
}

export type TimelineStatusDrawData = {timestamp1: number, label1: string, timestamp2: number, label2: string}[]

export type TimelineTranslateInitData = {nodeId: string, nodeName: string}

export type TimelineTranslateInitDatas = {name: string, data: TimelineTranslateInitData[]}[]
